home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / jovept2.arc / TERMS.C < prev    next >
Text File  |  1985-05-30  |  3KB  |  268 lines

  1. /* terms.c */
  2. /* JOVE/MSDOS. K. Mitchum 1/85 */
  3. /* Modifications for personal use only. */
  4. /* original code J. Payne LSRHS 5/83 */
  5. /* Ken Mitchum */
  6. /* University of Pittsburgh */
  7. /* Decision Systems Laboratory */
  8.  
  9.  
  10. #include "tm.h"
  11. #include "jove.h"
  12. #include "termcap.h"
  13. #include "term.h"
  14. #include "screen.h"
  15.  
  16.  
  17. extern int VisBell;
  18.  
  19. /*--------------------------o.s. dependent-------------------------*/
  20.  
  21. #ifdef TERMCAP
  22. outchar(c)
  23. char c;
  24. {
  25.     Putc(c, (&termout));
  26.     return;
  27. }
  28.  
  29.  
  30. ins_mode()
  31. {
  32.     putpad(IM,1);
  33.  
  34. }
  35. ex_ins_mode()
  36. {
  37.     putpad(EI,1);
  38. }
  39.  
  40. ins_chr()
  41. {
  42.     putpad(IC,1);
  43.     return;
  44. }
  45.  
  46. ex_ins_chr()
  47. {
  48.     putpad(EI,1);
  49. }
  50.  
  51.  
  52. del_chr()
  53. {
  54.     putpad(DC,1);
  55. }
  56.  
  57. wipeline()
  58. {
  59.     putpad(CE,1);
  60.     return;
  61. }
  62.  
  63. wipescreen()
  64. {
  65.     putpad(CL,LI);
  66.     return;
  67. }
  68.  
  69. inslines(n)
  70. int n;
  71. {
  72.     while (n--) putpad(AL,1);
  73.     return;
  74. }
  75.  
  76. dellines(n)
  77. int n;
  78. {
  79.     while (n--) putpad(DL,1);
  80.     return;
  81. }
  82.  
  83. SetHL()
  84. {
  85.     putpad(SO,1);
  86. }
  87.  
  88. UnSetHL()
  89. {
  90.     putpad(SE,1);
  91. }
  92.  
  93. #else            /* dedicated driver */
  94.  
  95.  
  96. ins_mode()
  97. {
  98.     (*tt.t_INSmode) (1);
  99.  
  100.     return;
  101. }
  102.  
  103. ex_ins_mode()
  104. {
  105.     (*tt.t_INSmode) (0);
  106.     return;
  107. }
  108.  
  109. del_chr()
  110. {
  111. (*tt.t_delchars) (1);
  112. return;
  113. }
  114.  
  115. wipeline()
  116. {
  117. (*tt.t_wipeline) (1);
  118.     return;
  119. }
  120.  
  121. wipescreen()
  122. {
  123. (*tt.t_wipescreen) ();
  124.     return;
  125. }
  126.  
  127. inslines(n,bot)
  128. int n,bot;
  129. {
  130.     (*tt.t_inslines)(n,bot);
  131.     return;
  132. }
  133.  
  134. dellines(n,bot)
  135. int n,bot;
  136. {
  137.     (*tt.t_dellines)(n,bot);
  138.     return;
  139. }
  140.  
  141. SetHL()
  142. {
  143.     (*tt.t_HLmode) (1);
  144. }
  145.  
  146. UnSetHL()
  147. {
  148.     (*tt.t_HLmode) (0);
  149. }
  150.  
  151.  
  152.  
  153. outchar(c)
  154. char c;
  155. {
  156.  
  157.  
  158.     if((c & 0x7f)  >= ' ') putp(c);
  159.     else {
  160.         if(c == '\n') {
  161.            Placur(CapLine +1, 0);
  162.            (*tt.t_wipeline) (1);
  163.         }
  164.         if(c == '\t') {
  165.            Placur(CapLine +1, 0);
  166.            printf("TAB!!!!");
  167.         }
  168.         if(c == '\r') {
  169.            Placur(CapLine,0);
  170.         }
  171.     }
  172.     return;
  173. }
  174.  
  175.  
  176. #endif
  177.  
  178. /* common routines */
  179.  
  180.  
  181. init_term()
  182. {
  183. #ifdef TERMCAP
  184.     CanScroll = ((AL && DL) || VT);
  185.     hasIC = ((IC || IM) && DC);
  186.  
  187.     hasIM = (IM && EI);
  188.  
  189.     putpad(CL, 1);
  190.     if (IS)
  191.         putpad(IS, 1);
  192.     if (VS)
  193.         putpad(VS, 1);
  194. #else
  195.     (*tt.t_init) ();
  196. #endif
  197.     return;
  198. }
  199.  
  200. term_exit()
  201. {
  202.  
  203. #ifdef TERMCAP
  204.     if (VE)
  205.         putpad(VE, 1);
  206.     Placur(LI - 1, 0);
  207.     putpad(CE, 1);
  208.     flusho();
  209. #endif
  210.     return;
  211. }
  212.  
  213.  
  214. UnsetTerm()
  215. {
  216.     ttyset(0);
  217. #ifdef TERMCAP
  218.     if (VE)
  219.         putpad(VE, 1);
  220.     Placur(LI - 1, 0);
  221. #endif
  222.     outchar('\n');
  223.     flusho();
  224. }
  225.  
  226. ResetTerm()
  227. {
  228. #ifdef TERMCAP
  229.     if (IS)
  230.         putpad(IS, 1);
  231.     if (VS)
  232.         putpad(VS, 1);
  233. #endif
  234.     ttyset(1);
  235.  
  236. }
  237.  
  238.  
  239.  
  240. #ifdef UNIX
  241. Putc(x,p)
  242. char x;
  243. IOBUF *p;
  244. {
  245.      (--(p)->io_cnt>=0 ? ((int)(*(p)->io_ptr++=(unsigned)(x))):flushout(x, p));
  246. }
  247.  
  248. sendbell()
  249. {
  250. #ifdef TERMCAP
  251.         if (VisBell && VB)
  252.             putstr(VB);
  253.         else
  254. #endif
  255.             outchar('\007');
  256.         RingBell = 0;
  257. }
  258.  
  259. #else
  260. sendbell()
  261. {
  262.     bdos(6,7);
  263.     RingBell = 0;
  264.  
  265. }
  266.  
  267. #endif
  268.